import bpy
import gpu


class DepthMap:
    depth_display_items = (
        ("ALWAYS_DISPLAY", "Always display",
         "Keep the silhouette displayed all the time, even when not in sculpting mode"),
        ("ONLY_SCULPT", "Only Sculpt", "Display silhouette images only in sculpting mode"),
        ("ONLY_BBRUSH", "Only Bbrush", "Display silhouette images only in Bbrush mode"),
        ("NOT_DISPLAY", "Not Display", "Never display silhouette images at any time"),
    )

    depth_display_mode: bpy.props.EnumProperty(
        name="Silhouette Display Mode",
        default="ONLY_SCULPT" if gpu.platform.device_type_get() != "AMD" else "NOT_DISPLAY",
        items=depth_display_items
    )

    depth_scale: bpy.props.FloatProperty(
        name="Silhouette image scaling",
        default=0.3,
        max=2,
        min=0.01,
    )
    depth_offset: bpy.props.IntVectorProperty(name="Silhouette image offset", default=(0, -80), size=2,
                                              max=114514, min=-114514)
    depth_refresh_interval: bpy.props.FloatProperty(name="Refresh interval", default=2, min=1, max=10)

    def draw_depth(self, layout):
        box = layout.box()
        box.label(text="Silhouette")
        box.prop(self, "depth_display_mode")
        if self.depth_display_mode in ("ALWAYS_DISPLAY", "ONLY_SCULPT"):
            box.prop(self, "depth_refresh_interval")
        box.prop(self, "depth_scale")
        row = box.row(align=True)
        row.prop(self, "depth_offset")
